package com.example.bleuesprit.parkAndroidClient;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;



/**
 * Created by bleuesprit on 2015/11/2.
 */
public class AboutMeActivity extends Activity {

    SharedPreferences sharedPreference;

    EditText aboutmeAccount_EdT;
    EditText aboutmeName_EdT;
    EditText aboutmeTelNumberd_EdT;
    EditText aboutmeLicence_EdT;

    Button aboutme_Logout_Bnt;



    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == 0x123) {

                return;
            }
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        sharedPreference=this.getSharedPreferences("appconfig", MODE_PRIVATE);

        setContentView(R.layout.activity_aboutme);
        aboutmeAccount_EdT=(EditText) findViewById(R.id.aboutme_account);
        aboutmeName_EdT=(EditText)findViewById(R.id.aboutme_name);
        aboutmeTelNumberd_EdT=(EditText)findViewById(R.id.aboutme_telNumberd);
        aboutmeLicence_EdT=(EditText)findViewById(R.id.aboutme_licence);
        aboutme_Logout_Bnt=(Button)findViewById(R.id.aboutme_logout);

        aboutmeAccount_EdT.setText(sharedPreference.getString("account","ERROR"));
        aboutmeName_EdT.setText(sharedPreference.getString("name","ERROR"));
        aboutmeTelNumberd_EdT.setText(sharedPreference.getString("telNumberd","ERROR"));
        aboutmeLicence_EdT.setText(sharedPreference.getString("licence","ERROR"));

        aboutme_Logout_Bnt.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        SharedPreferences.Editor edit = sharedPreference.edit();
                        edit.remove("account");
                        edit.remove("name");
                        edit.remove("telNumberd");
                        edit.remove("licence");
                        edit.putBoolean("autoLogin", false);
                        edit.putBoolean("rememberAccount", false);
                        edit.commit();

                        Intent intent=new Intent(AboutMeActivity.this,LoginActivity.class);
                        startActivity(intent);
                        finish();
                    }
                }
        );


    }


}
